package cn.cqie.frame.mapper;

import cn.cqie.frame.bo.query.QueryEmpBo;
import cn.cqie.frame.entity.Emp;
import cn.cqie.frame.vo.EmpVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author XYHL
 * @since 2021-10-09
 */
public interface EmpMapper extends BaseMapper<Emp> {
    @Select("<script>" +
            "SELECT emp.id,emp.name,emp.code,sex,mobile,dept.`name` as deptName,account as userAccount" +
            " FROM " +
            "  emp" +
            "  JOIN sys_user on sys_user.id = emp.userId " +
            "  JOIN dept on dept.`code` = emp.deptId" +
            " <where>" +
            "<if test=\"keywords!=null and !keywords.isEmpty\">" +
            " name like CONCAT('%',#{keywords},'%')" +
            "</if>" +
            " </where>" +
            "</script>")
    List<EmpVo> listEmp(QueryEmpBo bo);
}
